import App from './App'
import Vue from 'vue'
import store from 'store/index'
import uview from 'uview-ui'
import 'global/global.css'
Vue.use(uview)

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App,
	store
})

uni.$loading = (title = '加载中...') => {
	uni.showLoading({
		title,
		mask: true
	})
}
uni.$showMsg = (title, icon = 'success', duration = 1500) => {
	uni.showToast({
		title, //标题 必填
		icon, //图标
		duration
	});
}

Vue.filter('dateFormat', originVal => {
	const dt = new Date(originVal)
	const nowY = new Date().getFullYear()
	const y = dt.getFullYear()
	const m = (dt.getMonth() + 1 + '').padStart(2, '0')
	const d = (dt.getDate() + '').padStart(2, '0')
	const hh = (dt.getHours() + '').padStart(2, '0')
	const mm = (dt.getMinutes() + '').padStart(2, '0')
	if(y === nowY){
		// +1 月份从一开始，拼接空格字符串，加0补全两位数
	// const ss = (dt.getSeconds() + '').padStart(2, '0')
	return `${m}月${d}日 ${hh}:${mm}`
	}else{
		return `${y}年${m}月${d}日 ${hh}:${mm}`
	}
	
	
})


app.$mount()
